/*
 * gprs.c
 *
 *  Created on: 2017年7月5日
 *      Author: zjm
 */

#include "../mongoose.h"
#include "db.h"

int get_apn(struct mg_connection *nc)
{
	mg_printf(nc,"cmnet");

	return 0;
}

int get_apn_user(struct mg_connection *nc)
{
	mg_printf(nc,"");

	return 0;
}

int get_apn_passwd(struct mg_connection *nc)
{
	mg_printf(nc,"");

	return 0;
}

int apn_save(struct mg_connection *nc,struct http_message *hm)
{
	struct{
		char apn[128];
		char user[128];
		char passwd[128];
	}var;

	if(mg_get_http_var(&hm->body,"apn",var.apn,128) > 0){

	}
	if(mg_get_http_var(&hm->body,"apn_user",var.user,128) > 0){

	}
	if(mg_get_http_var(&hm->body,"apn_passwd",var.passwd,128) > 0){

	}

	mg_printf(nc, "HTTP/1.1 200 OK\r\nContent-Length: %lu\r\n\r\n%.*s",
	            (unsigned long) hm->body.len, (int) hm->body.len, hm->body.p);

	return 0;
}

int gprs_restart(struct mg_connection *nc,struct http_message *hm)
{

	return 0;
}
